// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'

Vue.config.productionTip = false

/* eslint-disable no-new */

// 开始引入


//VueLazyLoad的懒加载 必须要放到mint-ui前面不然懒加载loadings属性失效
import VueLazyLoad from 'vue-lazyload'
Vue.use(VueLazyLoad, {
  loading: require('./common/imgs/loading.gif'),
  error: require('./common/imgs/lo.jpg'),
})

//图片懒加载

// Vue.use(VueLazyload, {
//   preload: 1.3, //预加载的宽高
//   loading: "img的加载中的显示的图片的路径",
//   error: "img加载失败时现实的图片的路径",
//   attempt: 3, //尝试加载的次数
//   listenEvents: ['scroll', 'wheel', 'mousewheel', 'resize', 'animationend', 'transitionend', 'touchmove'], //你想让vue监听的事件
// })



import '../static/css/reset.css' // 引入写好的基础样式全局引入



import store from './store' //引入vuex




// mint-ui
import MintUI from 'mint-ui' //ui组件引入   npm安装依赖
import 'mint-ui/lib/style.css'
import {
  Button,
  Cell
} from 'mint-ui'
// import {
//   MessageBox
// } from 'mint-ui';
Vue.use(Button)
Vue.use(Cell)
Vue.use(MintUI)
// Vue.use(MessageBox)




//引入自定义json数据
import './mock/mockServer.js'






//全局过滤器                           //自定义时间过滤器 
Vue.filter('dataFormat', function (datastr, pattern = '') {
  let data = new Date(datastr)
  let year = data.getFullYear()
  let month = data.getMonth() + 1;
  let day = data.getDate()
  let hour = data.getHours()
  let minute = data.getMinutes()
  let second = data.getSeconds()
  // return year + '-' + month + '-' + day
  if (pattern.toLowerCase() === 'yyyy-mm-dd') {
    return `${year}-${month}-${day}`
  } else {
    return `${year}-${month}-${day} ${hour}:${minute}:${second}`
  }

})







new Vue({
  el: '#app',
  router,
  render: h => h(App), //引入
  store //注册vuex

})
